'use strict'

// es7
async function func1() {
  return 'func 1'
}

async function func2() {
  return 'func 22'
}

async function func3() {
  return 'func 333'
}

async function test() {
  let rs1 = await func1()
  let rs2 = await func2()
  let rs3 = await func3()
  console.log(rs1, rs2, rs3)
}

test()

// co
import co from 'co'

co(function* () {
  let rs1 = yield Promise.resolve(true)
  let rs2 = yield Promise.resolve('abc123def')
  let rs3 = yield Promise.resolve({ error: false, msg: 'ok' })
  console.log(rs1, rs2, rs3)
})